package com.shizhanzhe.qdd.forward.dialog;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

import com.shizhanzhe.qdd.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by zz9527 on 2019/1/4.
 */
public class SharePopWindow extends PopupWindow {
    @BindView(R.id.wx)
    LinearLayout wx;
    @BindView(R.id.wxcircle)
    LinearLayout wxcircle;
    @BindView(R.id.qq)
    LinearLayout qq;
    @BindView(R.id.qqkj)
    LinearLayout qqkj;
    @BindView(R.id.wb)
    LinearLayout wb;
    private ShareListener mListener;
    public void setListener(ShareListener mListener) {
        this.mListener = mListener;
    }
    public SharePopWindow(Context context) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View contentView = inflater.inflate(R.layout.pop_share,
                null);
        this.setContentView(contentView);
        ButterKnife.bind(this, contentView);
        setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        setOutsideTouchable(true);
        setFocusable(true);
        setBackgroundDrawable(new ColorDrawable(Color.WHITE));
    }

    @OnClick({R.id.wx, R.id.wxcircle, R.id.qq, R.id.qqkj, R.id.wb})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.wx:
                mListener.shareFriend();
                break;
            case R.id.wxcircle:
                mListener.shareCircle();
                break;
            case R.id.qq:
                mListener.shareQQ();
                break;
            case R.id.qqkj:
                mListener.shareQQKJ();
                break;
            case R.id.wb:
                mListener.shareWB();
                break;
            default:

        }
    }


    public interface ShareListener {
        void shareFriend();

        void shareCircle();

        void shareQQ();

        void shareQQKJ();

        void shareWB();
    }
}
